package com.sanwu.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import com.sanwu.dto.ManagerDto;
import com.sanwu.entity.Business;
import com.sanwu.service.ManagerService;
import com.sanwu.vo.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author hgh
 * @date 2025/3/11
 * @apiNote
 */

@Slf4j
@Component
@Api(tags = "管理端")
@RestController("/manager")
public class ManagerController extends BaseController {

    @Resource
    private ManagerService managerService;

    @GetMapping("/phoneMessageLogin")
    @ApiOperation("短信验证码登录")
    public AjaxResult phoneMessageLogin(String phoneMessage) {
        return managerService.phoneMessageLogin(phoneMessage);
    }

    @GetMapping("/sendCheckCodeManager")
    @ApiOperation("发送短信验证码")
    public AjaxResult sendCheckCode() {
        return managerService.sendCheckCode();
    }

    @PostMapping("/queryAllBusiness")
    @ApiOperation("查看所有的业务")
    public TableDataInfo queryAllBusiness(@RequestBody ManagerDto managerDto) {
        startPage();
        List<Business> list = managerService.queryAllBusiness(managerDto);
        return getDataTable(list);
    }

    @PostMapping("/businessDetail")
    @ApiOperation("查看业务详情")
    public AjaxResult businessDetail(@RequestBody ManagerDto managerDto) {
        return managerService.businessDetail(managerDto);
    }

}

